//
//  EditBabyGrowEntryView.h
//  BabyHelper
//
//  Created by  thomas on 11-6-25.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "Dao.h"
#import "BabyGrowEntry.h"
#import "Utility.h"
//#import "AssetsLibrary/AssetsLibrary.h";
#import "PhotoManager.h"
#import <Three20/Three20.h>

@interface EditBabyGrowEntryView : UIViewController <UIActionSheetDelegate,
UIImagePickerControllerDelegate >{
	UILabel *heightLabel;
	UILabel *weightLabel;
	UILabel *headCirLabel;	
	UILabel *commentsLabel;
	UILabel *heightUnitLabel;
	UILabel *weightUnitLabel;
	UILabel *headCirUnitLabel;
	UILabel *dateLabel;
	UITextField *heightTextField;
	UITextField *weightTextField;
	UITextField *headCirTextField;
	UITextField *commentsTextField;
	UIButton *dateButton;	
	UIDatePicker *pickerView;
	NSDateFormatter *dateFormatter; 
	UIImagePickerController   *imgPicker;
	
	UIView *processingView;
	TTActivityLabel* processingLabel;

	UIButton *picButton;
	UIImageView *pickedImageView;
	BabyGrowEntry *currentBabyGrowEntry;
	UIImage*		pickedPhoto;
	UIActionSheet *progressSheet;
	BOOL   photoChanged;
}

@property (nonatomic,retain) IBOutlet UIView  *processingView;
@property (nonatomic,retain) TTActivityLabel* processingLabel;

@property (nonatomic,retain) IBOutlet UILabel *heightLabel;
@property (nonatomic,retain) IBOutlet UILabel *weightLabel;
@property (nonatomic,retain) IBOutlet UILabel *headCirLabel;
@property (nonatomic,retain) IBOutlet UILabel *commentsLabel;
@property (nonatomic,retain) IBOutlet UILabel *heightUnitLabel;
@property (nonatomic,retain) IBOutlet UILabel *weightUnitLabel;
@property (nonatomic,retain) IBOutlet UILabel *headCirUnitLabel;
@property (nonatomic,retain) IBOutlet UILabel *dateLabel;	

@property (nonatomic,retain) IBOutlet UITextField *heightTextField;
@property (nonatomic,retain) IBOutlet UITextField *weightTextField;
@property (nonatomic,retain) IBOutlet UITextField *headCirTextField;	
@property (nonatomic,retain) IBOutlet UITextField *commentsTextField;

@property (nonatomic,retain) IBOutlet UIButton *dateButton;	
@property (nonatomic,retain) IBOutlet UIButton *picButton;
@property (nonatomic,retain) IBOutlet UIImageView *pickedImageView;

@property (nonatomic,retain) IBOutlet UIDatePicker *pickerView; 
@property (nonatomic,retain) NSDateFormatter *dateFormatter; 

@property (nonatomic,retain) BabyGrowEntry *currentBabyGrowEntry;
@property (nonatomic,retain) IBOutlet UIImagePickerController *imgPicker;
@property (nonatomic,retain) UIImage*		pickedPhoto;
@property (nonatomic,retain) UIActionSheet *progressSheet;
@property (nonatomic) BOOL photoChanged; 

-(IBAction)backgroundTap:(id)sender;

-(void)SaveBabyGrowEntry;
-(BOOL)DataValidation;

-(IBAction)toggleDateControl:(id)sender;

-(void)SlideDownDatePicker;

-(IBAction)dateAction:(id)sender;	// when the user has changed the date picke values (m/d/y)

//funcs for load pic from camera or library
-(IBAction)toggleChoosePic:(id)sender;
- (NSArray*)availableMediaTypes:(UIImagePickerControllerSourceType) pickerSourceType;
- (void)setImage:(UIImage*)img movie:(NSURL*)url;
- (BOOL)mediaIsPicked;
- (void)startUploadingOfPickedMediaIfNeed;
-(NSString *)saveImageToLocalFS;
- (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize;
- (UIImage *)thumbnailOfImage:(UIImage*)image withSize:(CGSize)aSize;
- (BOOL)writeImage:(UIImage*)image toFileAtPath:(NSString*)aPath;
@end
